import React from "react";
import { renderToString } from "react-dom/server";
import App from "./App.jsx";
import { getScripts } from "./getScripts.js";
import { getLinks } from './getLinks.js'

export default (req, res) => {
    const str = renderToString(<App/>)
    const html = `
      <!DOCTYPE html>
      <html lang="en">
      <head>
          <meta charset="UTF-8">
          <meta name="viewport" content="width=device-width, initial-scale=1.0">
          <title>Document</title>
          ${getLinks()}
      </head>
      <body>
          <div id="root" >${str}</div>
          ${getScripts()}
      </body>
      </html>`;
  
      res.send(html)
  }